<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */
    
    /*********************************************************
    *            --== InArch ==--
    *
    * This is the key class to all the admin side data nodes.
    * It is extended into child classes which do all the work.
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @copyright essentialmind.com 2005
    *
    *********************************************************/
    
    /***
    * Class adminNodePage
    ****
    * This class handles the editing of simple HTML pages in INA
    ****
    * @package adminNodes
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @copyright essentialmind.com 2005
    ***/
    class adminNodeShopCart extends adminNode{
        
		/**
         * a data processor.
         * 
         * @return 
         **/
        function process(){
            if($_POST){
                //update database record
                $this->db->Execute("UPDATE node_shop_cart SET content = '".addslashes($_POST['content'])."' WHERE id = " . $this->object);
                
                //updates the status of the page (title, wf state)
                $this->updatePageStatus();
                
                //make a note of the ajax request
                $this->log->recordAction("Updated Shop Cart Page (".$this->object.") with global id (".$this->pageref.")");
            
                header('Location: '.$this->request.'&confirm=true');
                exit;
            }else{
                $this->smarty->assign('page',$this->db->getRow("SELECT title, content FROM pagemap LEFT JOIN node_shop_cart ON pagemap.pageid = node_shop_cart.id WHERE pagemap.id = " . $this->pageref));
            }
        }
        
        /**
         * Will set the HTML template needed for
         * the child's operation
         * 
         * @return 
         **/
        function setTemplate(){
            $this->setActionTemplate('nodes/editHTMLPage.html');
        }
        
        
		/** 
         * method which will handle a default add action to the
         * dedicated table
         * 
         * @return integer ID of new object
         * @see ajaxAddPage
         * @see ajaxAddNode
         **/
        function addInstance(){
            $this->db->Execute("INSERT INTO node_shop_cart(content) VALUES('')");
            return $this->db->getOne("SELECT last_value FROM node_shop_cart_id_seq");
        }
    }
?>